Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate with ElementInternals #1121

Closed
wants to merge 1 commit into from
Closed

Integrate with ElementInternals #1121

wants to merge 1 commit into from

Conversation

seanpdoyle
Copy link
Contributor

Closes #1023

Replace the requirement for an <input type="hidden"> element with direct <form> integration through built-in support for ElementInternals.

According to the Form-associated custom elements section of More capable form controls, various behaviors that the <trix-editor> element was recreating are provided out of the box.

For example, the <input type="hidden">-[input] attribute pairing can be achieved through ElementInternals.setFormValue. Similarly, the <label> element support can be achieved through
ElementInternals.labels.

TODO before merging:

  • Control through browser feature-detection and a Trix.config.editor object
  • Open a PR against rails/rails to make Action Text integrate with configuration in a backwards-compatible way (excluding <input type="hidden">, rendering content into <trix-editor> inner HTML, etc)

TODO after merging:

Closes [#1023][]

Replace the requirement for an `<input type="hidden">` element with
direct `<form>` integration through built-in support for
[ElementInternals][].

According to the [Form-associated custom elements][] section of [More
capable form controls][], various behaviors that the `<trix-editor>`
element was recreating are provided out of the box.

For example, the `<input type="hidden">`-`[input]` attribute pairing can
be achieved through [ElementInternals.setFormValue][]. Similarly, the
`<label>` element support can be achieved through
[ElementInternals.labels][].

[#1023]: #1023
[ElementInternals]: https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals
[Form-associated custom elements]: https://web.dev/articles/more-capable-form-controls#form-associated_custom_elements
[More capable form controls]: https://web.dev/articles/more-capable-form-controls
[ElementInternals.setFormValue]: https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/setFormValue
[ElementInternals.labels]: https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/labels
@seanpdoyle seanpdoyle closed this by deleting the head repository Jan 30, 2024
@seanpdoyle seanpdoyle mentioned this pull request Jan 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Does Trix plan to support HTMLElement.attachInternals?
1 participant